
	 <?php
	 $db_host = 'localhost';
	 $db_user = 'function';
	 $db_pwd = 'w9ak4X1l0Y';

	 $database = 'function_a5110060';
	$con = mysql_connect($db_host, $db_user, $db_pwd);	
	$functionHallId = $_REQUEST['functionHallId'];

	 
	 mysql_select_db($database,$con) or die(mysql_error());

	 $funcName_result = mysql_query("SELECT Function_hall_name FROM Function_Hall WHERE Function_hall_id = ".$functionHallId) or die(mysql_error());
	 $funcName_info = mysql_fetch_row($funcName_result);

	 echo $funcName_info[0];
	 	 
	 $result = mysql_query("SELECT dates, GROUP_CONCAT(distinct  concat(status,':',slot)) slot
							FROM  Availability_Details
							WHERE  function_hall_id = ".$functionHallId." GROUP BY dates") or die(mysql_error());
	?>
	<br>*** Note *** <span class="booked">Red font for booked slots</span> and <span class="available">Greeen font for available slots</span>
	<p><div id="wrapper">
			<?php
							 while($info = mysql_fetch_array( $result )) 
							 {							
						
			?>
			
					<div id="div1" class="alldivs" style="background-color: white;border: 1px solid #CCCC33;">
						Date: <?php echo $info['dates']; 

						$slots_array = $info['slot'];
						if($slots_array!=''){	
							$slots = explode(',',$slots_array);
							?>
							<br>Slots:
							<?php
							for($k = 0;$k<sizeof($slots);$k++){
								$pos = strpos($slots[$k], ':');
								if ($pos !== false) {
									$status = substr($slots[$k],0,strpos($slots[$k], ':'));
									$time_slot = substr($slots[$k],strpos($slots[$k],':')+1);
									
									if(strcmp("booked",$status) == 0)	{?>
										<br>
										<span class="booked"><?php echo $time_slot; ?></span>
										<?php 
										}else{?>
										<br>
										<span class="available"><?php echo $time_slot; ?></span>
										<?php
										}
									}//end ifpost
								}//end for loop
							}//end if slots_array
										?>
								</div>
							<?php 		
								
						}//end while
					?>
			</p>

		